/*

Author   : chaos

FileName : out_of_range.cpp

Date     : 16/08/17 22:37:25

*/
#include <iostream>
#include <string>
#include <stdexcept>
using namespace std;

int main(int argc ,char *argv[])
{
    string * s;

    try
    {
        s = new string("John");
        cout << s->substr(10,2);

    }
    catch(out_of_range o)
    {
        cout << "Throw an exception : " << o.what() << endl;
    }
    catch(bad_alloc ba)
    {
        cout << "Throw an exception : " << ba.what() << endl;
    }
    return 0;
}
